package LinerSearch;

import java.util.Objects;

/**
 * @ClassName: Student
 * @Description: TODO
 * @Author: LiangPengFei
 * @Date: 2021/1/4 0:25
 * @Version: 1.0
 **/
public class Student {
    private String name;
    public Student(String name){
        this.name = name;
    }

//    equals是父类Object的方法,所以传参Object类型
    @Override
    public boolean equals(Object student){
        if (this == student) return true;
        if (student == null || getClass()!=student.getClass()) return false;
        Student student1 = (Student) student;
//        忽略大小写

        return this.name.toLowerCase().equals(student1.name.toLowerCase());
    }

//
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        Student student = (Student) o;
//        return Objects.equals(name, student.name);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(name);
//    }
}
